﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlMatHang.ascx.cs"
    Inherits="UserControl_ControlMatHang" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>


<script type="text/javascript">
    function pageLoad() {

        //giá mặt hàng
        $("#<%= txtPrice.ClientID %>").numeric({ allow: "." });

      


        $("#<%= imgBtnAdd.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= btnSave.ClientID %>").click(function () {
            if ($("#<%= txtMaSo.ClientID %>").val().length > 0 && $("#<%= txtDescription.ClientID %>").val().length > 0 && $("#<%= txtUnit.ClientID %>").val().length > 0) {
                $.blockUI({ css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#000',
                    '-webkit-border-radius': '10px',
                    '-moz-border-radius': '10px',
                    opacity: .5,
                    color: '#fff'
                }
                });
            }
        });
       
        $("#<%= btnSearch.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }
    }

</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="direct_container_right_titletop">
            Quản lý thông tin mặt hàng
        </div>
        <hr />
        <!-- Button chuc nang-->
        <div class="direct_container_main">
            <asp:ImageButton ID="imgBtnAdd" CausesValidation="false" ImageUrl="~/Images/add.png"
                Width="32px" Height="32px" runat="server" OnClick="imgBtnAdd_Click" />
           <%-- <asp:ImageButton ID="imgBtnSave" ImageUrl="~/Images/save.png" Width="32px" Height="32px"
                runat="server" OnClick="imgBtnSave_Click" />
            <asp:ImageButton ID="imgBtnDelete" ImageUrl="~/Images/delete.png" Width="32px" Height="32px"
                runat="server" OnClick="imgBtnDelete_Click" />
            <asp:ImageButton ID="imgBtnFind" CausesValidation="false" ImageUrl="~/Images/find.png"
                Width="32px" Height="32px" runat="server" OnClick="imgBtnFind_Click" />--%>
        </div>
        <!-- End Button chuc nang-->
        <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" BackColor="#CCFFFF"
            Font-Names="Arial" Width="100%">
            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Nhập thông tin" TabIndex="0">
                <ContentTemplate>
                    <!-- Content main-->
                    <div class="direct_container_main">
                        <div class="direct_container_form_right">
                            <table border="0" width="100%">
                                <tr>
                                    <td colspan="4" align="center">
                                        <asp:Label ID="lblMsg" runat="server" Visible="false" BackColor="Silver" ForeColor="Blue" Font-Bold="true" Font-Italic="true"></asp:Label>
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td width="12%" align="right">
                                        <p class="direct_label">
                                            Mã hàng<span>*</span></p>
                                    </td>
                                    <td width="88%" align="left">
                                        <asp:TextBox ID="txtMaSo" CssClass="input_code" runat="server"></asp:TextBox>
                                         <asp:RequiredFieldValidator ControlToValidate="txtMaSo" Display="None" ID="RFVMaHang"
                                            runat="server" ErrorMessage="Phải nhập mã hàng!"></asp:RequiredFieldValidator>
                                <cc1:ValidatorCalloutExtender TargetControlID="RFVMaHang" ID="ValidatorCalloutExtender1"
                                            runat="server" Enabled="True">
                                            </cc1:ValidatorCalloutExtender>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Mô tả<span>*</span></p>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtDescription" CssClass="input_full" runat="server"></asp:TextBox>
                                         <asp:RequiredFieldValidator ControlToValidate="txtDescription" Display="None" ID="RequiredFieldValidator1"
                                            runat="server" ErrorMessage="Phải nhập mô tả!"></asp:RequiredFieldValidator>
                                <cc1:ValidatorCalloutExtender TargetControlID="RequiredFieldValidator1" ID="ValidatorCalloutExtender2"
                                            runat="server" Enabled="True">
                                            </cc1:ValidatorCalloutExtender>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="12%" align="right">
                                        <p class="direct_label">
                                            Mã hàng 2</p>
                                    </td>
                                    <td width="88%" align="left">
                                        <asp:TextBox ID="txtMaSo1" CssClass="input_code" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Mô tả 2</p>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="txtDescription1" CssClass="input_full" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="12%" align="right">
                                        <p class="direct_label">
                                            Mã mở rộng</p>
                                    </td>
                                    <td width="88%" align="left">
                                        <asp:TextBox ID="txtExtendedCode" CssClass="input_code" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="12%" align="right">
                                        <p class="direct_label">
                                            Đơn vị tính<span>*</span></p>
                                    </td>
                                    <td width="88%" align="left">
                                        <asp:TextBox ID="txtUnit" CssClass="input_code" runat="server"></asp:TextBox>
                                        <asp:RequiredFieldValidator ControlToValidate="txtUnit" Display="None" ID="RequiredFieldValidator2"
                                            runat="server" ErrorMessage="Phải nhập đơn vị tính!"></asp:RequiredFieldValidator>
                                <cc1:ValidatorCalloutExtender TargetControlID="RequiredFieldValidator2" ID="ValidatorCalloutExtender3"
                                            runat="server" Enabled="True">
                                            </cc1:ValidatorCalloutExtender>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Thuế VAT</p>
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlVAT" runat="server">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                 <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Nhà cung cấp</p>
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddVendor" runat="server">
                                        </asp:DropDownList>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Ngành hàng</p>
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlNganhHang" runat="server"  AutoPostBack="true"
                                            onselectedindexchanged="ddlNganhHang_SelectedIndexChanged">
                                        </asp:DropDownList>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Nhãn hiệu</p>
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlNhanHieu" runat="server">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Sản phẩm</p>
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlProduct" runat="server">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="12%" align="right">
                                        <p class="direct_label">
                                            Giá bán</p>
                                    </td>
                                    <td width="88%" align="left">
                                        <asp:TextBox ID="txtPrice" Text="0" CssClass="input_code" runat="server"></asp:TextBox>
                                        <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtendertxtPrice" 
                                            runat="server" Enabled="True" FilterType="Numbers" 
                                            TargetControlID="txtPrice">
                                         </cc1:FilteredTextBoxExtender>
                                    </td>
                                </tr>
                               
                                <tr>
                                    <td align="right">
                                        <p class="direct_label">
                                            Trạng thái</p>
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="ddlStatus" runat="server">
                                        </asp:DropDownList>
                                        
                                        <asp:Button ID="btnSave" runat="server" Text="Lưu" onclick="btnSave_Click"/>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <!-- EndContent main-->
                </ContentTemplate>
            </cc1:TabPanel>
            <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Tìm kiếm" TabIndex="1">
                <ContentTemplate>
                    <div class="direct_container_main">
                        <div class="direct_container_form_right">
                            <table border="0" width="100%">
                                <tr>
                                    <td>
                                        <p class="direct_legend">
                                            Nhập thông tin cần tìm</p>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="middle">
                                        <asp:TextBox ID="txtSearch" CssClass="input_full" runat="server"></asp:TextBox>
                                        <asp:Button ID="btnSearch" CssClass="direct_bt_search" runat="server" CausesValidation="False"
                                            Text="Tìm kiếm" OnClick="btnSearch_Click" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:GridView ID="grvMatHang" runat="server" AllowPaging="true" PageSize="10"
                                        AutoGenerateColumns="False" DataKeyNames="MaHang"
                                            OnRowCommand="grvMatHang_RowCommand" 
                                            OnPageIndexChanging="grvMatHang_PageIndexChanging">
                                            <Columns>
                                                <asp:TemplateField HeaderText="Stt">
                                                    <HeaderTemplate>
                                                        STT
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <%# Container.DataItemIndex + 1 %>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Mã hàng 1">
                                                    <HeaderTemplate>
                                                        Mã hàng 1
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblMaSo" runat="server" Text='<%# Eval("MaHang")%>'></asp:Label>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Mô tả 1">
                                                    <HeaderTemplate>
                                                        Mô tả 1
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <%# Eval("MatHang")%>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" Width="200px" />
                                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Mã hàng 2">
                                                    <HeaderTemplate>
                                                        Mã hàng 2
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <%# Eval("MaHang1")%>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Mô tả 2">
                                                    <HeaderTemplate>
                                                        Mô tả 2
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <%# Eval("MatHang1")%>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" Width="200px" />
                                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Mã mở rộng">
                                                    <HeaderTemplate>
                                                        Mã mở rộng
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <%# Eval("MaMoRong")%>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Ngành hàng">
                                                    <HeaderTemplate>
                                                        Ngành hàng
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <%# Eval("NganhHang")%>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" Width="200px" />
                                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Nhãn hiệu">
                                                    <HeaderTemplate>
                                                        Nhãn hiệu
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <%# Eval("NhanHieu")%>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" Width="200px" />
                                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Sản Phẩm">
                                                    <HeaderTemplate>
                                                        Sản Phẩm
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <%# Eval("SanPham")%>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" Width="200px" />
                                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Nhà cung cấp">
                                                    <HeaderTemplate>
                                                        Nhà cung cấp
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <%# Eval("vendorname")%>
                                                    </ItemTemplate>
                                                    <HeaderStyle HorizontalAlign="Left" Width="200px" />
                                                    <ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <asp:ImageButton ID="imgBtnChon" runat="server" CausesValidation="False" CommandName="chon"
                                                            Height="25px" Width="25px" ImageUrl="~/Images/check.png" />
                                                    </ItemTemplate>
                                                    <ControlStyle BackColor="White" BorderColor="White" />
                                                    <FooterStyle BackColor="White" BorderColor="White" />
                                                    <HeaderStyle BackColor="White" BorderColor="White" />
                                                    <ItemStyle BackColor="White" BorderColor="White" />
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                    </td>
                                </tr>
                                </tr>
                            </table>
                        </div>
                    </div>
                </ContentTemplate>
            </cc1:TabPanel>
        </cc1:TabContainer>
        <dxpc:ASPxPopupControl ID="MessageBox" PopupHorizontalAlign="WindowCenter"  PopupVerticalAlign="WindowCenter" Font-Bold="true" HeaderText="DRM-S" runat="server" Height="91px" 
        Width="601px">
        <ContentCollection>
<dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server" SupportsDisabledAttribute="True"></dxpc:PopupControlContentControl>
</ContentCollection>
    </dxpc:ASPxPopupControl>
    </ContentTemplate>
</asp:UpdatePanel>
